Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

440
Visualizações
how can assign value "$event" to template variable?

since I use several similar mat-inputs inside a template form, I define an ng-template for these mat-inputs and refer to it via *ngTemplateOutlet and also pass related data to the template as bellow:

<ng-template #formFieldInput let-hintMsg="hintMsg" let-lable="lable" let-        dataBinding="dataBinding">
  <mat-form-field appearance="outline" class="fa">
    <mat-label>{{lable}}</mat-label>
    <input matInput type="text"  name="nationalCode"
        [(ngModel)]="dataBinding" [disabled]="!personalInfoEdit"/>
    <mat-hint *ngIf="personalInfoEdit">{{hintMsg}}</mat-hint>
  </mat-form-field>
</ng-template>

// ... 

<ng-container *ngTemplateOutlet="formFieldInput; context:{hintMsg: 'Enter National Code', lable: 'National Code', dataBinding: profileDetails.nationalCode} ">
</ng-container>

but I got this error:

 [webpack-dev-middleware] Error: Cannot assign value "$event" to template variable "dataBinding". Template variables are read-only.

how can fix this problem? best regards

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda